﻿using HANS_BackStage.Model.WebModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web;
using System.Web.Security;

namespace HANS_BackStage.Common
{
    public   class Login_SeesionHelper
    {
        private const string ADMININFO_KEY = "__admininfo";
        public static void SetInfoCache(Login_AdminInfo info,HANS_Login login_model )
        {
            FormsAuthenticationHelper.SignIn(info.Name+","+login_model.RoleTye, login_model.RememberMe);
            HttpContext.Current.Session[ADMININFO_KEY] = info;
        }

        public static Login_AdminInfo GetUserInfo(string token)
        {
            return (Login_AdminInfo)HttpContext.Current.Session[ADMININFO_KEY];
        }
    }
}
